package com.zxbit.flash.network;

import com.zxbit.flash.response.AlertDialogResponse;
import com.zxbit.flash.response.AuthInfoResponse;
import com.zxbit.flash.response.AuthResponse;
import com.zxbit.flash.response.BankListResponse;
import com.zxbit.flash.response.BannerResponse;
import com.zxbit.flash.response.BindedCardResponse;
import com.zxbit.flash.response.BlankResponse;
import com.zxbit.flash.response.BorrowingResponse;
import com.zxbit.flash.response.CalculateResponse;
import com.zxbit.flash.response.CheckOrderResponse;
import com.zxbit.flash.response.CompareResultResponse;
import com.zxbit.flash.response.CreateOrderResponse;
import com.zxbit.flash.response.DictionaryResponse;
import com.zxbit.flash.response.FaceBookLoginResponse;
import com.zxbit.flash.response.HelpCenterResponse;
import com.zxbit.flash.response.IdentityResponse;
import com.zxbit.flash.response.LoginResponse;
import com.zxbit.flash.response.PayCodeResponse;
import com.zxbit.flash.response.PayCodeResponseNew;
import com.zxbit.flash.response.PersonalInfoResponse;
import com.zxbit.flash.response.ProductResponse;
import com.zxbit.flash.response.UpdateResponse;
import com.zxbit.flash.response.UserInformationResponse;

import java.util.HashMap;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

public interface ApiService {

    String HEADER_TOKEN_KEY = "Authorization";
    String PATH = "channel";

    @POST("/api/app/loan/common/installStatistics") // 归因统计
    Observable<BlankResponse> appInstall(@Body RequestBody commonParams);

    @POST("/api/app/loan/common/{channel}/checkVersionGoogle") // 谷歌更新
    Observable<UpdateResponse> getGooglePlayUpdateInfo(@Path(PATH) String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("api/auth/jwt/login") // 老用户登陆
    Observable<LoginResponse> passwordLogin(@Body RequestBody body);

    @POST("/api/app/loan/regist") // 注册&&找回密码 type : 1 注册 2 找回密码
    Observable<BlankResponse> doRegisterQuest(@Body RequestBody body);

    @POST("/api/app/loan/common/{channel}/sendSms") // 获取短信验证码
    Observable<BlankResponse> getVerifyCode(@Path(PATH) String channel, @Body RequestBody body);

    @POST("/api/app/loan/common/{channel}/sendVoice") // 获取语音验证码
    Observable<BlankResponse> getVoiceCode(@Path(PATH) String channel, @Body RequestBody body);

    @POST("/api/app/loan/common/{channel}/saveLonglatitude") // 上报经纬度(注册)
    Observable<BlankResponse> uploadLocationRegister(@Path(PATH) String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("/api/app/loanLonglatitude/saveLonglatitude") // 上报经纬度(提单)
    Observable<BlankResponse> uploadLocation(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("/api/auth/jwt/{channel}/accountKitLogin") // facebook登陆
    Observable<FaceBookLoginResponse> accountKitLogin(@Path(PATH) String channel, @Body RequestBody commonParams);

    @POST("api/app/loan/common/{channel}/getNoticeByChannel") // 获取公告
    Observable<BannerResponse> getNotice(@Path(PATH) String channel, @Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanOrderApply/getRemindInfo") // 获取首页弹窗
    Observable<AlertDialogResponse> getAlertInfo(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loan/common/{channel}/prodRange") // 产品等级的接口（首页调用产品的接口）
    Observable<ProductResponse> getProduct(@Path(PATH) String channel, @Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanProdDetail/app-api/get/calculate/list") // 获取产品计算详情（业务方代码 全部）
    Observable<CalculateResponse> getAllCalculateData(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

//    @POST("/api/app/loanProdDetail/{channel}/calculate")// 获取产品计算详情(牌照方代码 单条)
//    Observable<CalculateResponse> getCalculateData(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanOrderApply/{channel}/checkOrderQualifications") // 判断是否可以提单
    Observable<CheckOrderResponse> checkOrderQualifications(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    @POST("/api/app/loanOrderApply/{channel}/createOrder") // 提单接口
    Observable<CreateOrderResponse> createOrder(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    @POST("/api/app/user/authentication/app-api/get/status") // 获取认证状态(七步)
    Observable<AuthResponse> getAuthStatus(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/user/authentication/app-api/get/detail") // 获取认证信息
    Observable<AuthInfoResponse> getAuthInfoData(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    @POST("/api/app/loanCustomerInfo/app-api/save/or/update") // 保存认证信息
    Observable<BlankResponse> savePersonalAuth(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    @POST("/api/app/loanIdentity/app-api/save/or/update") // 保存身份证信息
    Observable<BlankResponse> saveIdentity(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanContactsInfo/app-api/save/or/update") // 提交通讯录信息
    Observable<BlankResponse> uploadContactData(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/user/authentication/app-api/face/compare") // 身份证对比
    Observable<CompareResultResponse> imgCompare(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @Multipart // 上传身份证照片
    @POST("/api/app/user/authentication/app-api/upload/image")
    Observable<IdentityResponse> uploadIdentityCard(@Header(HEADER_TOKEN_KEY) String header, @QueryMap HashMap<String, Object> map, @Part MultipartBody.Part file);

    @Multipart // 上传图片(补充资料)
    @POST("/api/app/user/authentication/app-api/upload/image")
    Observable<IdentityResponse> uploadSingleImg(@Header(HEADER_TOKEN_KEY) String header, @QueryMap HashMap<String, Object> map, @Part MultipartBody.Part file);

    @POST("/api/app/dictInfo/{channel}/queryDictInfoList") // 获取字典数据
    Observable<DictionaryResponse> getDictionaryData(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/dictInfo/queryDictInfoList") // 获取字典数据(无渠道号)
    Observable<DictionaryResponse> getDictionaryData(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanBankList/app-api/get/auth/bank/detail") // 获取银行卡
    Observable<BindedCardResponse> getBindedCardData(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanBankList/app-api/save/or/update") // 提交银行卡
    Observable<BlankResponse> saveBankCardInfo(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanIdentity/{channel}/getIdentityInfo") // 获取用户信息
    Observable<PersonalInfoResponse> getPersonalInfo(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    @POST("/api/app/loanBankList/getBankListByChannel") // 获取银行卡列表
    Observable<BankListResponse> getBankList(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    @POST("/api/app/user/authentication/app-api/update/additional/information")  // 保存其他资料
    Observable<BlankResponse> saveAddInformation(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("/api/app/loanOrderApply/{channel}/getOrderPageList") // 分页获取账单列表
    Observable<BorrowingResponse> getOrderPageList(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("/api/app/loan/repay/voucher/get/list") // 获取还款码
    Observable<PayCodeResponseNew> getPayCodeDataNew(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("/api/app/loanOrderApply/{channel}/saveExtendedPayCode") // 获取还款码数据
    Observable<PayCodeResponse> getRolloverPayCodeData(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    @POST("/api/app/helpCenter/{channel}/getHelpCenterByChannel") // 获取帮助中心
    Observable<HelpCenterResponse> getHelpCenter(@Path("channel") String channel, @Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    @POST("/api/app/loanOrderApply/app-api/get/back/status") // 获取用户资料退回
    Observable<UserInformationResponse> getUserInformation(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);
}
